<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>纯javascript</title>
</head>
<body>
	<div id="view-div">这是个div-</div>
</body>
<script type="text/javascript">
	//1、创建xmlhttprequest对象
	var xhr = new XMLHttpRequest();
	//2、.open(type,url/file,async)
	xhr.open('GET', '/demo/list?p=3', true);

	//3、两种请求方式onload/onreadystatechange
	// xhr.onload = function(){
	//     console.log(this.responseText);
	// }

	xhr.onreadystatechange = function() {
		if (this.status == 200 && this.readyState == 4) {
			console.debug('...返回是....', this.responseText);
		} else if (this.status == 404) {
			console.log("请求的页面不存在");
		}
	}
	//4、发送请求
	xhr.send();
</script>
</html>